package org.infosys.feign;

import feign.hystrix.FallbackFactory;
import org.infosys.domain.User;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return id -> User.builder().intro("熔断").build();
    }

    /*@Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User getById(Long id) {
                return User.builder().intro("熔断").build();
            }
        };
    }*/
}
